<?php
header("Content-Type: text/html; charset=utf-8");
require_once '../setting/setting.php';
require_once '../smarty/Smarty.class.php';
require_once '../lib/query_railway.php';
require_once '../lib/base.php';

if($_POST["act"]=="login") {
	$nick=urldecode($_POST["nick"]);
	$password=urldecode($_POST["pw"]);
	$str=" nick='".$nick."'and ps='".$password."'";
	$data=QR::get_data($tb_user, "*",$str,0,1);
	if($data){
		$user=$data[0];
		if($user["status"]=="true" || $user["nick"]=="admin"){
			echo "100";
			$_SESSION["RU"]=$user;
		}else if($user["status"]=="false"){
			echo "审核未通过：".$user->error."详情请联系系统管理员！";
		}else{
			
			echo "未审核，请联系系统管理员！";
		}		
	}else{
		echo "用户名或密码错误！";
	}
	exit;
}
$_SESSION["RU"]=null;
//var_dump($data);

$str=" status='true' order by creattime desc";
$data=QR::get_data($tb_bl, "id,title,creattime",$str,0,5);
//var_dump($data);

$smarty = new Smarty;
$smarty->assign("userdata",$data);
$smarty->display('login.tpl');
?>